from sklearn.cluster import KMeans
import pandas as pd
import numpy as np

data = pd.read_csv('train.csv')
data.loc[data['Sex']=='male','Sex']=0
data.loc[data['Sex']=='female','Sex']=1
km = KMeans(n_clusters=3)
gender = np.array(data['Sex'])
label = km.fit_predict((gender.reshape(-1,1)))

